/**
 * 
 */
package starcafe.data;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.List;

import starcafe.ServeurInterface;

/**
 * Classe contienant un clinet
 * @author a.delevaux
 */
public class DataClient implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8424386697624002971L;

	/**
	 * Id du client
	 */
	private int idClient;
	
	/**
	 * Identifiant du client
	 */
	private String ident;
	
	/**
	 * Nom du client
	 */
	private String nom;
	
	/**
	 * Prenom du client
	 */
	private String prenom;
	
	/**
	 * Mot de passe du client
	 */
	private String mdp;
	
	/**
	 * Boolean indiquant que le client est en ligne
	 */
	private Boolean admin;

	/**
	 * @return the idClient
	 */
	public int getIdClient() {
		return idClient;
	}

	/**
	 * @param idClient the idClient to set
	 */
	public void setIdClient(int idClient) {
		this.idClient = idClient;
	}

	/**
	 * @return the ident
	 */
	public String getIdent() {
		return ident;
	}

	/**
	 * @param ident the ident to set
	 */
	public void setIdent(String ident) {
		this.ident = ident;
	}

	/**
	 * @return the nom
	 */
	public String getNom() {
		return nom;
	}

	/**
	 * @param nom the nom to set
	 */
	public void setNom(String nom) {
		this.nom = nom;
	}

	/**
	 * @return the prenom
	 */
	public String getPrenom() {
		return prenom;
	}

	/**
	 * @param prenom the prenom to set
	 */
	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	/**
	 * @return the mdp
	 */
	public String getMdp() {
		return mdp;
	}

	/**
	 * @param mdp the mdp to set
	 */
	public void setMdp(String mdp) {
		this.mdp = mdp;
	}

	/**
	 * @return the online
	 */
	public Boolean isAdmin() {
		return admin;
	}

	/**
	 * @param online the online to set
	 */
	public void setAdmin(Boolean online) {
		this.admin = online;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "DataClient [idClient=" + idClient + ", ident=" + ident
				+ ", nom=" + nom + ", prenom=" + prenom + ", mdp=" + mdp
				+ ", admin=" + admin + "]";
	}
	
	/**
	 * Obtenir ses propres achats
	 * @param serv
	 * @param ident identifiant de connexion
	 * @return
	 * @throws RemoteException
	 */
	public List<DataAchat> getListeAchat(ServeurInterface serv, String ident) throws RemoteException{
		return serv.getAchatClient(ident, this.ident);
	}
	

	/**
	 * Obtenir les achats d'un client
	 * @param serv
	 * @param ident identifiant de connexion
	 * @param client Client dont on veut les achat
	 * @return
	 * @throws RemoteException
	 */
	public static List<DataAchat> getListeAchat(ServeurInterface serv, String ident, String client) throws RemoteException{
		return serv.getAchatClient(ident, client);
	}
	
}
